package com.flitsneak.designpatterns.creationalpatterns.singleton;

/**
 * Author: flitsneak
 * Date: 2022/5/31 13:50
 * Description:双重检验锁懒汉式单例
 */
public class DCLSingleton {
    private volatile static DCLSingleton dclSingleton;

    private DCLSingleton() {
    }

    public static DCLSingleton getDclSingleton() {
        if (dclSingleton == null) {
            synchronized (DCLSingleton.class) {
                if (dclSingleton == null) {
                    dclSingleton = new DCLSingleton();
                }
            }
        }
        return dclSingleton;
    }
}
